﻿using System;
using Xtensive.Orm;

namespace DateTimeFields.Model
{
    /*
     * TimeSpan values are stored in column with 'interval' datatype, if database server supports it.
     * Overwise, bigint datatype is used to store interval values as number of nanoseconds.
     * Conversion and arithmetic operations are made on the fly.
     */
    [HierarchyRoot]
    public class Flight : Entity
    {
        [Field, Key]
        public int Id { get; set; }

        [Field]
        public string Transport { get; set; }

        [Field]
        public DateTime DepartureDate { get; set; }

        [Field]
        public string DepartureLocation { get; set; }

        [Field]
        public DateTime ArrivalDate { get; set; }

        [Field]
        public string ArrivalLocation { get; set; }

        [Field]
        public TimeSpan Duration { get; set; }

        public Flight(Session session) :
            base(session) {}
    }
}